jvc.ui.tab=new jvc_ui_tab();
function jvc_ui_tab(){
	//jvc.loadcss(jvc.baseUrl+'jvc/ui/tab.files/tab.css'); 
	this.obj;		
	this.nodes=[];
	this.add=function(name,url,selected){
		this.nodes[this.nodes.length]=new jvc_ui_tab_node(name,url,selected);
	}
	
	
	this.show=function(obj){	
		this.obj=obj;
		if(!this.divTabButtons)
		{
		this.divTabButtons=document.createElement("div");
		this.divTabFrame=document.createElement("div");
		this.obj.appendChild(this.divTabButtons);
		this.obj.appendChild(this.divTabFrame);		
	}
		this.tabLoad();
	}
	var tabAlign = "Left";
	this.tabOnClick=function (ID)
{
	var oElement = null;
	

	for (var i = 0; i < this.nodes.length; i++)
	{
		
		oElement = document.getElementById("tab_"+i);
		oElement.className = "tab4";
	}

	oElement = document.getElementById("tab_"+ID);
	oElement.className = "tab4_on";
	var node=this.nodes[ID];
	this.showframe(ID);
	//this.divTabFrame.innerHTML = "<IFRAME SRC="+node.url+" CLASS='tabFrame'  framespacing='no' frameborder='no' border='0'></IFRAME>";
	document.body.focus();
}
this.showframe=function(n){
 		  	
		  if(!this.nodes[n].created){
	 		  var oIFrameElement = document.createElement("iframe");	         
	          oIFrameElement.className="tabFrame";
	          oIFrameElement.src=this.nodes[n].url;
	          oIFrameElement.style.display="block";
	          oIFrameElement.scrolling="auto";
	          oIFrameElement.frameBorder ="0";
	          oIFrameElement.border="0";	          
			  this.divTabFrame.appendChild(oIFrameElement);		 
	          this.nodes[n].created=true;
	          this.nodes[n].frame=oIFrameElement;
          }
          	
	for(var i=0;i<this.nodes.length;i++)
	{
		if(i==n)this.nodes[i].frame.style.display="block";
		else if(this.nodes[i].created) this.nodes[i].frame.style.display="none";
	}
          

}
this.tabLoad=function ()
{
	var HTML = "";

	HTML += "<P ALIGN="+tabAlign+" style='margin:0'>";
	for (var i = 0; i < this.nodes.length; i++)
	{
		var node=this.nodes[i];	
		HTML += "<INPUT TYPE='BUTTON' ID=tab_"+i+" CLASS='tab4' style='width:83px' VALUE="+node.name+" onClick='jvc.ui.tab.tabOnClick("+i+")'>";
	}

	this.divTabButtons.innerHTML = HTML;

	for (var i = 0; i < this.nodes.length; i++)
	{
	
		var node=this.nodes[i];	

		if (node.selected)
		{
			
			this.tabOnClick(i);
			
			break;			
		}
	}
}
}
function jvc_ui_tab_node(name,url,selected){
	this.name=name;
	this.url=url;
	this.selected=selected?true:false;
	this.created=false;
	
}



